﻿using System;
using System.Collections.Generic;
using System.Text;

using Kenly.ChineseSegment.Core;

namespace Kenly.ChineseSegment
{
    internal abstract class SegmentDictionaryBase : ISegmentDictionary
    {
        #region ISegmentDictionary 成员

        private Dictionary<string, List<string>> _segments = new Dictionary<string, List<string>>();
        private List<string> _baseSegmentList = new List<string>();

        /// <summary>
        /// 分词字典。
        /// </summary>
        public Dictionary<string, List<string>> Segments
        {
            get
            {
                if (_segments == null)
                {
                    _segments = new Dictionary<string, List<string>>();
                }
                return _segments;
            }
            set
            {
                _segments = value;
            }
        }

        /// <summary>
        /// 分词链表。
        /// </summary>
        public List<string> SegmentList
        {
            get
            {
                return _baseSegmentList;
            }
        }

        /// <summary>
        /// 将分词链表解析到分词字典中。
        /// </summary>
        /// <param name="segmentList"></param>
        /// <returns></returns>
        public abstract bool Parse(List<string> segmentList);
       
        /// <summary>
        /// 将分词链表追加到分词字典中。
        /// </summary>
        /// <param name="segmentList"></param>
        /// <returns></returns>
        public abstract bool Append(List<string> segmentList);
        

        #endregion

      
    }
}
